<%@page import="hyl.ext.base.MySession"%>
<%@page import="com.servlet.M2"%>
<%@page language="java" contentType="application/json;charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page	import="hyl.core.db.*,com.servlet.My,hyl.core.info.Content,hyl.core.MyFun"%>
<%
	MySession tk = My.getSession(request,response);
	int role = tk.getRoleid();
	int index = MyFun.str2int(request.getParameter("rs_index"));
	int size = MyFun.str2int(request.getParameter("rs_size"));
	String oname = request.getParameter("oname");
	int id = MyFun.str2int(request.getParameter("id"));
	Content ct = new Content();
	////////////////////////////////dao//////////////////////////////////
	MySqlSelect count = MySqlSelect	.getInstance("SELECT COUNT(1) AS total FROM sys_dict WHERE 1=1 ");
	
	String sql = " SELECT dname,id,pid FROM sys_dict WHERE 1=1 {1} ORDER BY id DESC {2} ";

	MySqlSelect2 select = MySqlSelect2.getInstance(sql);
	SelectWhere sw = new SelectWhere();
	if(id==0){
		sw.add(" and pid=0 and vtype=1");
	}else{
		sw.add(" and pid=?",id);
	}
	
	//sw.add(" and ", tk.getUserId());
	count.addParams(sw);
	select.addParams(1, sw);
	select.fromto(2, index, size);
	ct.setCode(1, "查询成功");
	ct.iniBodys(count.getMap());
	ct.addBodyItem("_rs", select.getList2D());
	out.print(ct.toJsonString());
%>